/*
	This file is part of Sandbox.

	Copyright (C) 2008  Marleine Daoud <marleine@gmail.com>

	Sandbox is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Sandbox is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License 
	along with Sandbox.  If not, see <http://www.gnu.org/licenses/>.
*/

#import "search-by-example.h"

@implementation SearchCriteriaBox

- init {
	if (self = [super init])
	{
		[[self homogeneous: NO] spacing: 5];
		criteriabox = [[[[HBox alloc] init] homogeneous : NO] 
							 spacing: 5];
		searchbutton = [[[[Button alloc] init] label: "gtk-find"]
						       stock: YES];
		deselectAllbutton = [[[[Button alloc] init] 
			label: "Deselect All"] stock: NO];
		typecheckbutton = [[CheckButton alloc] init];
		typelabel = [[[Label alloc] init] text: "Type:"];
		typecombo = [[[[[[[ComboBox alloc] init] 
			appendText: "Rectangle"] appendText: "Ellipse"] 
			appendText: "Triangle"] appendText: "Note"] 
			 setActive: 0];
		typebox = [[[[[[[HBox alloc] init] homogeneous: NO] 
						       spacing: 2] 
			packStart: typecheckbutton] packStart: 
				typelabel: NO: NO: 5]
		       	packStart: typecombo: YES: YES: 0];
		
		
		//searchbetype = [[SearchByTypeUI alloc] init];

		stylecheckbutton = [[CheckButton alloc] init];
		stylelabel = [[[Label alloc] init] text: "Border Style:"];
		stylecombo = [[[[[ComboBox alloc] init] 
			appendText: "Continuous"] 
			appendText: "Dashed"] setActive: 0];
		stylebox = [[[[[[[HBox alloc] init] homogeneous: NO] 
							spacing: 2]
			packStart: stylecheckbutton] 
			packStart: stylelabel: NO: NO: 5] 
			packStart: stylecombo: YES: YES: 0];
		
		
		//searchbestyle = [[SearchByBorderStyleUI alloc] init];

		/*andorTypeStylelabel = [[[Label alloc] init] 
			text: "And/Or:"];		
		andorTypeStylecombo = [[[[[ComboBox alloc] init] 
			appendText: "And"] 
			appendText: "Or"] 
			 setActive: 0];
		andorTypeStylebox = [[[[[[HBox alloc] init] 
			homogeneous: NO] spacing: 20]
			packStart: andorTypeStylelabel: NO: NO: 25] 
			packStart: andorTypeStylecombo: YES: YES: 0];

		andorStyleLineColorlabel = [[[Label alloc] init] 
			text: "And/Or:"];
		andorStyleLineColorcombo = [[[[[ComboBox alloc] init]
		       	appendText: "And"] appendText: "Or"] 
			 setActive: 0];
		andorStyleLineColorbox = [[[[[[HBox alloc] init] 
			homogeneous: NO] spacing: 20] 
			  packStart: andorStyleLineColorlabel: NO: NO: 25]
		       packStart: andorStyleLineColorcombo: YES: YES: 0];

		andorLineFillColorlabel = [[[Label alloc] init] 
			text: "And/Or:"];

		andorLineFillColorcombo = [[[[[ComboBox alloc] init] 
			appendText: "And"] appendText: "Or"] 
			 setActive: 0];
		andorLineFillColorbox = [[[[[[HBox alloc] init] 
			homogeneous: NO] spacing: 20]
		packStart: andorLineFillColorlabel: NO: NO: 25]
	       	packStart: andorLineFillColorcombo: YES: YES: 0];*/
	       	
	   	linecolorcheckbutton = [[CheckButton alloc] init];
	    linecolorlabel = [[[Label alloc] init] 
		    text: "Line Border Color:"];
	    linecolorbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: linecolorcheckbutton]
			  packStart: linecolorlabel: NO: NO: 5];
	    
	    linecolorRlabel = [[[Label alloc] init] 
		    text: "Line Color R:"];
	    linecolorGlabel = [[[Label alloc] init] 
		    text: "Line Color G:"];
	    linecolorBlabel = [[[Label alloc] init] 
		    text: "Line Color B:"];
	    linecolorAlabel = [[[Label alloc] init] 
		    text: "Line Color A:"];
		linecolorRspin = [[[[SpinButton alloc] init] 
			range: 0: 255] step: 1: 5];
		linecolorGspin = [[[[SpinButton alloc] init] 
			range: 0: 255] step: 1: 5];
		linecolorBspin = [[[[SpinButton alloc] init] 
			range: 0: 255] step: 1: 5];
		linecolorAspin = [[[[SpinButton alloc] init] 
			range: 0: 255] step: 1: 5];
		
		linecolorRbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: linecolorRlabel: NO: NO: 5] 
			  packStart: linecolorRspin: YES: YES: 0];
		linecolorGbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: linecolorGlabel: NO: NO: 5] 
			  packStart: linecolorGspin: YES: YES: 0];
		linecolorBbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: linecolorBlabel: NO: NO: 5] 
			  packStart: linecolorBspin: YES: YES: 0];
		linecolorAbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: linecolorAlabel: NO: NO: 5] 
			  packStart: linecolorAspin: YES: YES: 0];
			  
			  
		//searchbeline = [[SearchByLineColorUI alloc] init];
			  
		fillcolorcheckbutton = [[CheckButton alloc] init];
		fillcolorlabel = [[[Label alloc] init] 
			text: "Fill Color:"];
		fillcolorbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: fillcolorcheckbutton]
			  packStart: fillcolorlabel: NO: NO: 5];
		
		fillcolorRlabel = [[[Label alloc] init] 
			text: "Fill Color R:"];
		fillcolorGlabel = [[[Label alloc] init] 
			text: "Fill Color G:"];
		fillcolorBlabel = [[[Label alloc] init] 
			text: "Fill Color B:"];
		fillcolorAlabel = [[[Label alloc] init] 
			text: "Fill Color A:"];
		fillcolorRspin = [[[[SpinButton alloc] init] 
			range: 0: 255] step: 1: 5];
		fillcolorGspin = [[[[SpinButton alloc] init] 
			range: 0: 255] step: 1: 5];
		fillcolorBspin = [[[[SpinButton alloc] init] 
			range: 0: 255] step: 1: 5];
		fillcolorAspin = [[[[SpinButton alloc] init] 
			range: 0: 255] step: 1: 5];
		fillcolorRbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: fillcolorRlabel: NO: NO: 11] 
			  packStart: fillcolorRspin: YES: YES: 0];
		fillcolorGbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: fillcolorGlabel: NO: NO: 11] 
			  packStart: fillcolorGspin: YES: YES: 0];
		fillcolorBbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: fillcolorBlabel: NO: NO: 11] 
			  packStart: fillcolorBspin: YES: YES: 0];
		fillcolorAbox = [[[[[[HBox alloc] init] homogeneous: NO] 
				spacing: 5] 
			  packStart: fillcolorAlabel: NO: NO: 11] 
			  packStart: fillcolorAspin: YES: YES: 0];
		
		
		//searchbefill = [[SearchByFillColorUI alloc] init];
		
	   	notecheckbutton = [[CheckButton alloc] init];
	    notelabel = [[[Label alloc] init] text: "Note/Comment:"];
	    notebox = [[[[[[HBox alloc] init] homogeneous: NO] spacing: 5]
			packStart: notecheckbutton]
			packStart: notelabel: NO: NO: 5];
			
		notetext = [[TextView alloc] init];
		notebuffer = (GtkTextBuffer *) gtk_text_buffer_new (NULL);
		[notetext setBuffer: notebuffer];
		
		savenotebutton = [[[[Button alloc] init] label: "Save Note/Comment"]
						       stock: NO];
						       
		//searchbenote = [[SearchByNoteUI alloc] init];
		
		/*andorFillColorNotelabel = [[[Label alloc] init] 
			text: "And/Or:"];

		andorFillColorNotecombo = [[[[[ComboBox alloc] init] 
			appendText: "And"] appendText: "Or"] 
			 setActive: 0];
		andorFillColorNotebox = [[[[[[HBox alloc] init] 
			homogeneous: NO] spacing: 20]
		packStart: andorFillColorNotelabel: NO: NO: 25]
	       	packStart: andorFillColorNotecombo: YES: YES: 0];*/
	    
		[[[[[[[[[[[[[[[[[[self 
			packStart: criteriabox]  
			packStart: typebox] 
			//packStart: searchbetype]
			//packStart: andorTypeStylebox]
			packStart: stylebox]
			//packStart: searchbestyle]
			//packStart: andorStyleLineColorbox]
			packStart: linecolorbox]
			packStart: linecolorRbox]
			packStart: linecolorGbox]
			packStart: linecolorBbox]
			packStart: linecolorAbox]
			//packStart: searchbeline]
			//packStart: andorLineFillColorbox]
			packStart: fillcolorbox]
			packStart: fillcolorRbox]
			packStart: fillcolorGbox]
			packStart: fillcolorBbox]
			packStart: fillcolorAbox] 
			//packStart: searchbefill]
			//packStart: andorFillColorNotebox]
			packStart: notebox]
			packStart: notetext]
			//packStart: searchbenote]
			packStart: savenotebutton]
			packStart: searchbutton]
			packStart: deselectAllbutton];
	}
}

- free {
	[searchbutton free];
	[deselectAllbutton free];
	[typelabel free];
	[criteriabox free];
	[typebox free];
	[typecheckbutton free];
	[typecombo free];
	
	//[searchbetype free];
	[stylecheckbutton free];
	[stylelabel free];
	[stylebox free];
	[stylecombo free];
	
	//[searchbestyle free];
	/*[andorTypeStylelabel free];
	[andorTypeStylecombo free];
	[andorTypeStylebox free];
	[andorStyleLineColorlabel free];
	[andorStyleLineColorcombo free];
	[andorStyleLineColorbox free];
	[andorLineFillColorlabel free];
	[andorLineFillColorcombo free];
	[andorLineFillColorbox free];*/
	[linecolorcheckbutton free];
	[linecolorlabel free];
	[linecolorbox free];
	[linecolorRlabel free];
	[linecolorGlabel free];
	[linecolorBlabel free];
	[linecolorAlabel free];
	[linecolorRspin free];
	[linecolorGspin free];
	[linecolorBspin free];
	[linecolorAspin free];
	[linecolorRbox free];
	[linecolorGbox free];
	[linecolorBbox free];
	[linecolorAbox free];
	//[searchbefill free];
	//[searchbefill free];
	[fillcolorcheckbutton free];
	[fillcolorlabel free];
	[fillcolorbox free];
	[fillcolorRlabel free];
	[fillcolorGlabel free];
	[fillcolorBlabel free];
	[fillcolorAlabel free];
	[fillcolorRspin free];
	[fillcolorGspin free];
	[fillcolorBspin free];
	[fillcolorAspin free];
	[fillcolorRbox free];
	[fillcolorGbox free];
	[fillcolorBbox free];
	[fillcolorAbox free];
	/*[andorFillColorNotelabel free];
	[andorFillColorNotecombo free];
	[andorFillColorNotebox free];*/
	[notebox free];
	[notecheckbutton free];
	[notelabel free];
	[notetext free];
	[savenotebutton free];
	g_free(notebuffer);
	//[searchbenote free];

	return [super free];
}

/*-searchbytype {
	
}

-searchbyborderstyle {
	
}

-searchbylinebordercolor {
	
}

-searchbyfillcolor {
	
}

-searchbycomment {
	
}
*/

@end

